package com.itheima.Demo01.demo03;

import java.util.Comparator;
import java.util.TreeSet;

public class Test02 {
    public static void main(String[] args) {

        TreeSet<String> set1 = new TreeSet<>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                int i = o1.length() - o2.length();
                int i1 = i == 0 ? o1.compareTo(o2) : i;
                return i1;
            }
        });


        Student s1 = new Student("abddasdasdasdsadc", 60);
        Student s2 = new Student("agdsadd", 30);
        Student s3 = new Student("bfsafsafsaas", 30);
        Student s4 = new Student("bds", 40);
        Student s5 = new Student("cafdsaddsa", 30);
        Student s6 = new Student("cafdsasafg", 41);
        set1.add(s1.getName());
        set1.add(s2.getName());
        set1.add(s3.getName());
        set1.add(s4.getName());
        set1.add(s5.getName());
        set1.add(s6.getName());


        System.out.println(set1);
    }
}
